﻿namespace Strategy
{
    /// <summary>
    /// 策略上下文
    /// </summary>
    public class Context
    {
        Strategy_ABS strategy;

        /// <summary>
        /// 实例化上下文时，创建具体策略对象
        /// </summary>
        /// <param name="strategy">具体策略对象</param>
        public Context(Strategy_ABS strategy)
        {
            this.strategy = strategy;
        }


        /// <summary>
        /// 上下文接口，根据具体策略对象调用具体策略
        /// </summary>
        public string ContextInterface() 
        {
            return strategy.AlgorithmInterface();
        }
    }
}
